#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 7;

// ̬静态->动态 
// O(n logn logn) 
int lowbit(int x) {return x & (-x);}
int n, q, a[N];
ll bit[N], ans;
ll query(ll x) { // sum 1--x
	ll s = 0;
	for(; x; x -= lowbit(x)) 
		s += bit[x];
	return s;
} 

void modify(int x, ll s) {
	for(; x <= n; x += lowbit(x))
		bit[x] += s;
} 
int main() {
	cin >> n >> q;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		modify(i, a[i]);
	} 
	
	for(int i = 1; i <= q; i++) {
		int ty;
		cin >> ty;
		if(ty == 1) { // 修改 
			int x, d; 
			cin >> x >> d;
			modify(x, d - a[x]);
			a[x] = d;
		} else { // 查询 
			ll x;
			cin >> x;
			int l = 0, r = n + 1;
			while(l + 1 < r) {
				int m = (l + r) >> 1;
				if(query(m) <= x)
					l = m;
				else
					r = m;
			}
			cout << l << "\n"; 
		} 
	}
		
	return 0;
}
